home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Testing & Debugging / Virtual User tools / VU Assist Modules for MacApp / Assist Module MA 2.0.1 / VUAssist Source Code / UVUAssist.a next >
Encoding:
Text File  |  1993-09-17  |  3.3 KB  |  118 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        UVUAssist.a
  3. ;
  4. ;    Contains:    hook VU assistance proc for the mole to call (glue routine for Object Pascal
  5. ;                method MoleAssist)
  6. ;
  7. ;    Written by:    David Shayer
  8. ;
  9. ;    Copyright:    © 1991 by Apple Computer, Inc., all rights reserved.
  10. ;
  11. ;    Version: 1.0d10
  12. ;
  13. ;    Change History (most recent first):
  14. ;
  15. ;         8/29/91    JAS        change version
  16. ;         8/21/91    JAS        change version
  17. ;         8/13/91    JAS        change ObjectIntf for TVUAssist to include
  18. ;                            fGridItemSupport data member
  19. ;         8/13/91    JAS        set CASE to OBJ
  20. ;         8/13/91    JAS        include ObjectIntf for TEvtHandler
  21.  
  22.         CASE        OBJ
  23.         INCLUDE        'ObjMacros.a'
  24.         INCLUDE        'SysEqu.a'
  25.         BLANKS        ON
  26.  
  27. ;    Historical Note:  References to the "Mole" are equivalent to references to 
  28. ;    "Agent VU".  "Agent VU" was previously called the "Mole".
  29. ;
  30. ;    FUNCTION MoleHook (Select :integer; Input :Ptr; VAR OutputSize :integer;
  31. ;            Result :integer) :OSErr; C;
  32. ;
  33. ;    This is a glue routine.  It is called by the mole, with a C interface.
  34. ;    It calls TVUAssist.MoleAssist with a Pascal interface.  It passes the
  35. ;    same parameters on, it just glues the C and Pascal interfaces together.
  36. ;
  37. ;    stack frame on entry (after LINK):
  38. ;    +-------------------+
  39. ;    |        Result        |
  40. ;    +-------------------+ <-- 18(A6)
  41. ;    |    *OutputSize        |
  42. ;    +-------------------+ <-- 14(A6)
  43. ;    |        Output        |
  44. ;    +-------------------+ <-- 10(A6)
  45. ;    |        Input        |
  46. ;    +-------------------+ <-- C(A6)
  47. ;    |        Select        |
  48. ;    +-------------------+ <-- 8(A6)
  49. ;    |    Return Address    |
  50. ;    +-------------------+ <-- 4(A6)
  51. ;    |        Old A6        |
  52. ;    +-------------------+ <-- A6
  53. ;
  54. ;    stack for call to TVUAssist.MoleAssist (at MethCall):
  55. ;    +-------------------+
  56. ;    |    Return Value    |
  57. ;    +-------------------+
  58. ;    |        Select        |
  59. ;    +-------------------+
  60. ;    |        Input        |
  61. ;    +-------------------+
  62. ;    |    *OutputSize        |
  63. ;    +-------------------+
  64. ;    |        Result        |
  65. ;    +-------------------+
  66. ;    |    Object Handle    |
  67. ;    +-------------------+ <-- A7
  68. ;
  69. ;    TVUAssist.MoleAssist will remove all parameters, leaving the return value
  70. ;    on the top of the stack.
  71. ;    The mole expects the return value in D0.  The mole will remove the parameters
  72. ;    it originally placed on the stack.
  73. ;
  74.  
  75.         Seg         'Main'
  76.  
  77. ;    Abridged object definition for TEvtHandler
  78.     ObjectIntf    TEvtHandler, TObject, \
  79.         (fIdleFreq,4),                \
  80.         (fLastIdle,4),                \
  81.         (fNextHandler,4)
  82.         
  83. ;    Abridged object definition for TVUASSIST
  84.     ObjectIntf    TVUASSIST, TEvtHandler,    \
  85.         (FMOLEREFNUM,2),            \
  86.         (GRIDITEMSUPPORT,1),            \
  87.         METHODS,                    \
  88.         (IVUASSIST),                \
  89.         (OPENMOLEDRIVER),            \
  90.         (SUSPENDMOLE),                \
  91.         (RESUMEMOLE),                \
  92.         (SETDEBUGGERHOOK),            \
  93.         (MOLEASSIST)
  94.  
  95. MoleHook PROC EXPORT
  96.         IMPORT        GVUASSIST:DATA        ;global pointer to VUAssist
  97.         LINK        A6, #$0                ;set up stack frame
  98.         MOVE.L        A5, -(A7)            ;save a5
  99.         MOVE.L        CurrentA5, A5        ;get application's A5
  100.         CLR.W        -(A7)                ;make space for return result
  101.         MOVE.W        $A(A6), -(A7)        ;push Select (load lo word)
  102.         MOVE.L        $C(A6), -(A7)        ;push Input
  103.         MOVE.L        $10(A6), -(A7)        ;push Output
  104.         MOVE.L        $14(A6), -(A7)        ;push OutputSize
  105.         MOVE.W        $1A(A6), -(A7)        ;push Result (load lo word)
  106.         MOVE.L        GVUASSIST(A5),-(A7)    ;push object handle, which will become "Self"
  107.         MethCall    MOLEASSIST,TVUASSIST;call TVUAssist.MoleAssist
  108.         MOVE.W        (A7)+, D0            ;pop return result
  109.         EXT.L        D0                    ;make return result a longword
  110.         MOVE.L        (A7)+, A5            ;restore A5
  111.         UNLK        A6                    ;tear down stack frame
  112.         RTS                                ;return
  113.         DC.B        'MOLEHOOK'            ;Macsbug name
  114.         ENDPROC
  115.         
  116.         
  117.         END
  118.